package com.evildog.workspace.dependencies.ding.builder;

import com.evildog.workspace.dependencies.ding.bean.DingRobotMessage;

public class DingRobotMessageBuilder {

    public static DingRobotMessage buildTextMessage(String content){
        DingRobotMessage.Text text = DingRobotMessage.Text.builder().content(content).build();

        return new DingRobotMessage()
                .setMsgtype(DingRobotMessage.Text.MSG_TYPE)
                .setText(text);
    }


    public static DingRobotMessage buildLinkMessage(
            String text,
            String title,
            String picUrl,
            String messageUrl
    ){
        DingRobotMessage.Link link = DingRobotMessage.Link.builder()
                .text(text)
                .title(title)
                .picUrl(picUrl)
                .messageUrl(messageUrl)
                .build();

        return new DingRobotMessage()
                .setMsgtype(DingRobotMessage.Link.MSG_TYPE)
                .setLink(link);
    }

    public static DingRobotMessage buildMarkdownMessage(
            String text,
            String title,
            String picUrl,
            String messageUrl
    ){
        DingRobotMessage.Markdown markdown = DingRobotMessage.Markdown.builder()
                .text(text)
                .title(title)
                .build();

        return new DingRobotMessage()
                .setMsgtype(DingRobotMessage.Markdown.MSG_TYPE)
                .setMarkdown(markdown);
    }


}
